import pandas as pd
import time

start = time.time()
last_year = pd.read_excel(r'/Users/user/PycharmProjects/text1/和鲸社区项目/dianshang平台数据/last_year_user_data.xlsx')
print(last_year.columns)
new_year = pd.read_csv(r'/Users/user/PycharmProjects/text1/和鲸社区项目/dianshang平台数据/user_table.csv')
# print(now_year.head(10))
# page = last_year.columns.tolist()
new_columns = last_year.columns.tolist()[-5:]
new_columns[-1] = 'payment_confirmation'
for i in new_columns:
    temp = pd.read_csv(fr'/Users/user/PycharmProjects/text1/和鲸社区项目/dianshang平台数据/{i}_table.csv')
    temp[i] = 1
    new_year = pd.merge(new_year, temp[['user_id',i]], how='left', on = 'user_id')
    new_year[i].fillna(0,inplace=True)

new_year.columns = last_year.columns
# print(new_year.describe())
# print(last_year.describe())
# 94——产品代码16promax——p_one九月二十号开始
# 84---产品代码15promax
# p_one = 打样
last_year= last_year[last_year.age<100]
print(last_year.age.sort_values())
new_year = new_year[new_year.age<100]
print(new_year.age.sort_values())


print(fr'程序运行花费了{round(time.time() - start, 2)} 秒')